/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package easy.core.bean;


import easy.entities.Tag;
import java.util.ArrayList;
import java.util.List;
import easy.entities.Cliente;

/**
 *
 * @author Julio
 */
public class TagManagedBean extends BaseBean{
    private static final long serialVersionUID = -6030006406328448445L;
    
    private Tag tag = new Tag();
    private List<Tag> listaTag = new ArrayList<Tag>();

    //controle de renderizações
    private boolean renderedBotaoAdicionar;
    private boolean renderedBotaoSalvar;
    private boolean renderedListaTag;

    private boolean controleEditar;

    public TagManagedBean(){
        controleEditar=false;
        renderedBotaoAdicionar=true;
    }

    public void adicionar(){
        renderedListaTag=true;
                
        if(!controleEditar){
           getListaTag().add(tag);
        }
        tag = new Tag();
        controleEditar=false;
        renderedBotaoAdicionar=true;
        renderedBotaoSalvar=false;
    }
    public void editar(){
        controleEditar=true;
        renderedBotaoAdicionar=false;
        renderedBotaoSalvar=true;
    }

    public void excluir(){
    System.out.println("Entrou em excluir");

       listaTag.remove(tag);
      
       tag = new Tag();
    }


    /**
     * @return the renderedBotaoAdicionar
     */
    public boolean isRenderedBotaoAdicionar() {
         return renderedBotaoAdicionar;
    }

    /**
     * @param renderedBotaoAdicionar the renderedBotaoAdicionar to set
     */
    public void setRenderedBotaoAdicionar(boolean renderedBotaoAdicionar) {
        this.renderedBotaoAdicionar = renderedBotaoAdicionar;
    }

    /**
     * @return the renderedBotaoSalvar
     */
    public boolean isRenderedBotaoSalvar() {
        return renderedBotaoSalvar;
    }

    /**
     * @param renderedBotaoSalvar the renderedBotaoSalvar to set
     */
    public void setRenderedBotaoSalvar(boolean renderedBotaoSalvar) {
        this.renderedBotaoSalvar = renderedBotaoSalvar;
    }

    /**
     * @return the tag
     */
    public Tag getTag() {
        return tag;
    }

    /**
     * @param tag the tag to set
     */
    public void setTag(Tag tag) {
        this.tag = tag;
    }

    public boolean getRenderedListaTag(){
        return renderedListaTag;
    }

    public void setRenderedListaTag(boolean renderedListaTag){
        this.renderedListaTag=renderedListaTag;
    }

    /**
     * @return the listTag
     */
    public List<Tag> getListaTag() {
        return listaTag;
    }

    /**
     * @param listTag the listTag to set
     */
    public void setListaTag(List<Tag> listTag) {
        this.listaTag = listTag;
    }
}
